<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<!-- 访问employee/下文件时，过滤器会跳回到首页，路径错乱 -->
<base href="<%=basePath%>">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登陆</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/signin.css" rel="stylesheet">
</head>
<body>
<div class="signin">
	<div class="signin-head" >
		<img src="images/title.png" >
	</div>
	<form class="form-signin" role="form" action="LoginServlet" method="post">
		<input type="text" class="form-control" placeholder="用户名" 
		           name="emp_no" id="emp_no" onblur="checkName()"  required autofocus/>
		<input type="password" class="form-control" name="emp_pass" id="emp_pass" onblur="checkPass()" placeholder="密码" />
		<input class="btn btn-lg btn-warning btn-block" type="submit" onsubmit="return checkAll()"></input>
		<label class="control-label"><br><div id="flag" style="color:red">${desc}</div></label>
	</form>
</div>
    <script type="text/javascript" src="js/jquery.min.js"></script>
   <script type="text/javascript">
        function checkName(){
        	$("#emp_no").blur(function(){
                var $name=$("#emp_no").val()
                var $reg=/^[a-zA-Z0-9]{4,10}$/
                 if($reg.test($name)){
                     return true;
                 }else{
                     alert("账号只能在4-10位");
                     return false;
                 }
            })
        }
        
        function checkPass(){
        	$("#emp_pass").blur(function(){
                var $pass=$("#emp_pass").val();
                if($pass.length>=6&&$pass.length<=18){
                	return true;
                }
                else{
                    alert("密码只能在6-18位");
                    return false;
                }
            })
        }
   
       function checkAll(){
    	   alert(checkName()+","+checkPass())
    	   if(checkName()&&checkPass()){
    	        return true
    	    }else{
    	        return false
    	    }
       }
   </script>
</body>  
</html>
